package com.yannickstucki.android.musicqueue;

import java.util.Random;

import com.yannickstucki.android.musicqueue.data.Song;
import com.yannickstucki.android.musicqueue.data.SongLibrary;

/**
 * A song picker that picks songs randomly.
 * 
 * @author Yannick Stucki
 *
 */
public class RandomSongPicker implements ISongPicker {
  
  /**
   * This class picks songs randomly.
   */
  private Random random = new Random();

  private SongLibrary songLibrary;
  
  /**
   * Constructor sets the song library reference and the random seed.
   */
  public RandomSongPicker() {
    random.setSeed(System.currentTimeMillis());
  }
  
  @Override
  public Song nextSong() {
    return songLibrary.allSongs.get(random.nextInt(songLibrary.allSongs.size()));
  }

  public void setSongLibrary(SongLibrary songLibrary) {
    this.songLibrary = songLibrary;
  }
}
